import java.time.LocalDateTime;
import java.util.Scanner;

class Manager extends User {
    private Cinema cinema;

    public Manager(String username, String password) {
        super(username, password, "Manager");
        this.cinema = Cinema.getInstance();
    }

    public void createSchedule(Movie movie, Hall hall, LocalDateTime time) {
        Schedule schedule = new Schedule(movie, hall, time);
        cinema.addSchedule(schedule);
        System.out.println("已创建排片: " + schedule);
    }

    public void viewSchedules() {
        System.out.println("所有排片:");
        for (Schedule schedule : cinema.getSchedules()) {
            System.out.println("- " + schedule);
        }
    }

    public void addMovie(Movie movie) {
        cinema.getMovieManagementSystem().addMovie(movie);
        System.out.println("已添加电影: " + movie.getName());
    }

    public void updateMovie(String oldName, Movie newMovie) {
        cinema.getMovieManagementSystem().updateMovie(oldName, newMovie);
    }

    public void deleteMovie(String name) {
        Scanner scanner = new Scanner(System.in);
        System.out.println("确认删除电影《" + name + "》? (Y/N)");
        String confirm = scanner.nextLine();
        if ("Y".equalsIgnoreCase(confirm)) {
            cinema.getMovieManagementSystem().deleteMovie(name);
        } else {
            System.out.println("删除已取消");
        }
    }

}
